<?php

namespace app\admin\controller;

use app\admin\controller\CommonController;
use app\util\File;
use app\util\Util;
use think\Log;

/*
 * 公共
 */
class PublicController extends CommonController
{
    /*
     * 上传图片
     */
    public function uploadImg()
    {
        $file = new File();

        $img = request()->file('img');

        $folder = input('post.folder');

        $name = $file->uploadImage($img, $folder . DS);
        if ($name) {
            return Util::ajaxReturn(1, '上传成功', $name);
        } else {
            return Util::ajaxReturn(0, '上传失败', null);
        }
    }

}